<?php
require 'runtime.php';
@$t = $_GET['t'];
@$callback = $_GET["callback"];
if(!in_array($t, array("wcc", "spb", "ics", "gics"))) exit;

$db = init_db();
$row = $db->get_rows("select `date`,`hour`,sum(`nums`) as nums from weather_count where `table`='{$t}' group by `date` order by `date`");

$data = array();
foreach($row as $r){
	$data[] = "[" . strtotime("$r[date] $r[hour]:0:0") . "000,$r[nums]]";
}

echo $callback. "([";
echo implode(",", $data);
echo "]);";